import { register } from '@antv/x6-vue-shape';
import { customNodeShape } from "@/enums/nodeType";

export const registerNode = (callback?: Function) => {
  customNodeShape.forEach((item, index) => {
    item.component().then((res: any) => {
      register({
        id: item.shape,
        shape: item.shape,
        component: res.default
      });
    })
    if(index === customNodeShape.length -1) {
      setTimeout(() => {
        console.log('全局自定义组件注册完成：',customNodeShape)
        callback && callback()
      }, 500);
    }
  })
}